package com.hcj.demo;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.runtime.ExecutionQuery;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;


@Slf4j
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

//    @Bean
//    public CommandLineRunner init(final RepositoryService repositoryService,
//                                  final RuntimeService runtimeService,
//                                  final TaskService taskService) {
//
//        return new CommandLineRunner() {
//            @Override
//            public void run(String... strings) {
//                log.info("Number of process definitions : {}" , repositoryService.createProcessDefinitionQuery().count());
//
//                log.info("Number of tasks : {}", taskService.createTaskQuery().count());
//
//
//                ProcessInstance oneTaskProcess = runtimeService.startProcessInstanceByKey("oneTaskProcess");
//                log.info("oneTaskProcess.getId()={}", oneTaskProcess.getId());
//                // 这里里面不能直接完成任务
//
//
//                log.info("Number of tasks after process start: ", taskService.createTaskQuery().count());
//            }
//        };
//    }

//    @Bean
//    public ProcessEngineConfiguration processEngineConfiguration(){
//        return null;
//    }

}
